package com.lagou.task13;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;

public class InstantTest {
    public static void main(String[] args) {
//        使用instance获取当前时间
        LocalDateTime time = LocalDateTime.now();
        Instant now = Instant.now();
        System.out.println(time);
        System.out.println(now);
        System.out.println("---------------------------------");
        //加上时区
        OffsetDateTime offsetDateTime = now.atOffset(ZoneOffset.ofHours(8));
        System.out.println(offsetDateTime);
    }
}
